import sys
import os
from PySide6.QtWidgets import *
from PySide6.QtGui import *
from PySide6.QtCore import *

class Demo(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.parent = parent
        layout = QHBoxLayout()  

        group = QGroupBox('Image')
        groupLayout =QHBoxLayout()
        
        label = QLabel()
        imageUrl = f'{self.parent.getAppDir()}/resources/test.png'
        image = QImage(imageUrl)        
        label.setPixmap(QPixmap.fromImage(image))        
        groupLayout.addWidget(label)
        group.setLayout(groupLayout)

        layout.addWidget(group)        

        group1 = QGroupBox('Image with scrollarea')
        groupLayout1 =QHBoxLayout()
        group1.setLayout(groupLayout1)
        label1 = QLabel()        
        label1.setPixmap(QPixmap.fromImage(image))
        scrollArea = QScrollArea()
        scrollArea.setWidget(label1)        
        groupLayout1.addWidget(scrollArea)
        group1.setLayout(groupLayout1)
        layout.addWidget(group1)


        self.setLayout(layout) 

def runDemo(parent):
    wigdet =  Demo(parent)
    return wigdet